import os
import time

from selenium import webdriver
from data_file_analysis.yaml_analysis import YamlAnalysis as ya

driver = webdriver.Chrome()
driver.get('https://work.weixin.qq.com/wework_admin/loginpage_wx?from=myhome')
time.sleep(20)
cookies = driver.get_cookies()

cookies_dict = {"cookies":cookies}

curpath = os.path.dirname(os.path.realpath(__file__))
yamlpath = os.path.join(curpath, "cookies.yaml")

#写入到yaml文件
ya.write_yaml(yamlpath, cookies_dict)

driver.close()
driver.quit()

